/**
 * zmn角色模块-角色授权员工列表
 * 文件命名格式：zmn.模块名称.表名称.功能.js
 * @author heguanghua
 * @since 2020/05/11 19:48
 */
layui.define(['index', 'form', 'table', 'zmnApp', 'laypage'], function (exports) {
    let $ = layui.$;
    let form = layui.form;
    let layer = layui.layer;
    let table = layui.table;
    let laypage = layui.laypage;
    let zmnApp = layui.zmnApp;

    table.init('zmn-table', {
        toolbar: "#zmn-table-tool",
        page: true,
        limit: json.pageSize,
        height: 'full-233'
    });
    laypage.render(zmnPage.laypageOptions(json));

    // 启用/停用（批量）
    table.on("toolbar(zmn-table)", function (obj) {
        if(obj.event == "cancel") {
            let ids = appUtil.layTabldIds(obj, ['staffId'], 'roleId');
            if(ids.length === 0){ return layer.alert("请选择要取消对此角色授权的员工"); }
            layui.layer.confirm('确认取消授权吗？', function() {
                zmnPage.ajaxSimple(zmnApp.SYS_BASE_URL +"/role/staff/modify/cancel.action", { ids: ids.join(",")}, 1000);
            });
        }
    });

    layer.ready(function(){
        if(json.status){
            $("#status").val(json.status);
            form.render();
        }
    });

    //对外暴露的接口
    exports('role_staff_list', {});
});
